<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script language="JavaScript" src="/js/vue.min.js"></script>
    <script language="JavaScript" src="/js/axios.min.js"></script>
    <script type="text/javascript" src="/js/jquery.js"></script>
</head>
<body>
<div id="UserDiv">
    <table border="1">
        <tr>
            <td>编号</td>
            <td>昵称</td>
            <td>真实姓名</td>
            <td>拥有金额</td>
            <td>权限</td>
        </tr>
        <tr v-for="user in userInforList">
            <td>{{user.userid}}</td>
            <td>{{user.username}}</td>
            <td>{{user.realname}}</td>
            <td>{{user.usermoney}}</td>
            <td>
                <button @click="orderlist(user.userid)">订单信息</button>
            </td>
        </tr>
    </table>
<!--    查询用户信息以及用户的订单列表-->
<!--    <a href="/order_list.html">订单信息</a>-->
</div>
<script language="JavaScript">
    var vm = new Vue({
        el: "#UserDiv",
        data: {
            userInforList: []
        },
        created() {
            this.finduserInforList();
        },
        methods: {
            finduserInforList: function () {
                var path = "http://localhost:8070/user/find"
                axios.get(path).then(function (obj) {
                    if (obj.status == 200) {
                        var pathResult = obj.data;
                        vm.userInforList = pathResult.obj;
                        return;
                    }
                }).catch(function (error) {
                    alert("用户有异常了")
                })
            },

            //显示订单
            orderlist:function (userid) {
                window.location.href="order_list.html?valus="+userid;
            }
        }
    });

</script>
</body>
</html>